﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Runtime.InteropServices;

namespace MT.eVotePRS.Device.Native
{
    internal static class ARSAPIWrapper
    {
        [DllImport("HS Receiver.dll")]
        public static extern int IsExistArsDevice();

        [DllImport("HS Receiver.dll")]
        public static extern int RegisterDeviceNotify(Int32 hwnd);
        
        [DllImport("HS Receiver.dll")]
        public static extern void UnRegisterDeviceNotify();

        [DllImport("HS Receiver.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern int ReadData(
            Int32 pipenum,
            ref byte pData,
            Int32 L,
            Int32 timeout
            );
        
        [DllImport("HS Receiver.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern int WriteData(
            Int32 pipenum,
            ref byte pData,
            Int32 L,
            Int32 timeout
            );

        [DllImport("HS Receiver.dll")]
        public static extern int ClearReadBuffer();

    }

    public class Win32Message
    {
        public const Int32 WM_DEVICECHANGE = 0x219;
        public const Int32 DBT_DEVICEARRIVAL = 0x8000;
        public const Int32 DBT_DEVICEREMOVECOMPLETE = 0x8004;
    }
}
